<?php
require_once('EmsModelObject.php');
class User extends EmsModelObject
{
	
	private $username;
	public function Username($value)
	{
	    if($value == NULL)
	        return $this->username;
	    $this->username = $value;        
	            
	}
	
	private $password;
	public function Password($value)
	{
	    if($value == NULL)
	        return $this->password;
	    $this->password = $value;        
	            
	}
	
	private $userRole;
	public function UserRole($value)
	{
	    if($value == NULL)
	        return $this->userRole;
	    $this->userRole = $value;        
	            
	}
	
	private $firstName;
	public function FirstName($value)
	{
	    if($value == NULL)
	        return $this->firstName;
	    $this->firstName = $value;        
	            
	}
	
	private $lastName;
	public function LastName($value)
	{
	    if($value == NULL)
	        return $this->lastName;
	    $this->lastName = $value;        
	            
	}
	
	public function __construct($entity)
	{
		//Map entity to object
	}
	
	public function IsValid()
	{
		$isValid = true;
		//All Properties are mendatory.
		//Loop through and check for NULL. If NULL -> add name to property error list
		foreach($this as $var => $value)
		{
			if(!isset($value))
			{
				$isValid = false;
				$this->AddPropertyError($var);
			}
		}
		return $isValid;
	}
	
	public function SaveChanges()
	{
		//Save changes to DB
	}
	
	public static function GetType()
	{
		return __CLASS__;
	}
}

?>
